{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "37e79d75-eae8-4d46-8b16-684596077e86",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 2]\n",
      "[3 4]\n",
      "加法运算 [4 6]\n",
      "减法运算 [-2 -2]\n",
      "乘法运算 [3 8]\n",
      "除法运算 [0.33333333 0.5       ]\n",
      "幂运算 [ 1 16]\n",
      "比较运算 [False False]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "n1=np.array([1,2])\n",
    "n2=np.array([3,4])\n",
    "print(n1)\n",
    "print(n2)\n",
    "# 数组运算\n",
    "print('加法运算',n1+n2)\n",
    "print('减法运算', n1-n2)\n",
    "print('乘法运算', n1*n2)\n",
    "print('除法运算', n1/n2)\n",
    "print('幂运算', n1**n2)\n",
    "print('比较运算', n1>n2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f51e81ab-908d-4c7a-a584-b3880b8d9c49",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "# 数组中的索引\n",
    "n=np.array([1,2,3,4,5])\n",
    "print(n[2])\n",
    "print(n[-3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c9ea1ccd-a8c5-4ff4-9cd9-6663c9af65f2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 2 3 4]\n",
      " [5 6 7 8]]\n",
      "[5 6 7 8]\n",
      "5\n",
      "6\n"
     ]
    }
   ],
   "source": [
    "n=np.array([[1,2,3,4],[5,6,7,8]])\n",
    "print(n)\n",
    "print(n[1])\n",
    "print(n[1][0])\n",
    "print(n[1,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2307a5b2-dff1-4f87-88a6-a821daaab705",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0ccfa9e4-55d3-4211-b3a4-7f54e4b9f336",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ef23d363-5644-4858-9931-196e544f1f7c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a9abbc38-8568-474f-b217-3380102c0d5e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "18ffafb6-0069-40eb-a0d3-db7a94753426",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
